package com.coldchain.admin.rpc;

import com.coldchain.admin.user.service.ICompanyService;
import com.coldchain.common.msg.BaseResponse;
import com.coldchain.common.msg.ObjectRestResponse;
import com.coldchain.common.vo.CompanyVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @ClassName Company
 * @Description  公司模块远程调用接口
 * @Author fangliai
 * @Date 2018/9/22 12:45
 * @Vesion 1
**/
 @RestController
 @ApiIgnore
public class CompanyRpcController {
    @Autowired
    private ICompanyService companyService;
    /**
     * 使用信用额度支付订单
     * @param amount
     * @return
     */
    @RequestMapping("/company/payOrder")
    public BaseResponse useAmountPayOrder(String companyId, String ornderNo, BigDecimal amount){
        companyService.useAmountPayOrder(companyId,ornderNo,amount);
        return  new ObjectRestResponse<>().succeed();
    }

    @RequestMapping("/company/info/{id}")
    public ObjectRestResponse<Map<String,Object>> getCompanyInfo(@PathVariable("id") String id){

        return new ObjectRestResponse<>().data(companyService.getCompanyInfo(id));
    }

    @GetMapping("/company/data")
    public List<Map<String, CompanyVo>> getCompanyList(){
        return null;
    }


}
